﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DDNY.WebPortals.Common
{
    public class UrlHelper
    {
        public static string ExtractDomainNameFromURL(string Url)
        {
            return "http://" + System.Text.RegularExpressions.Regex.Replace(
                Url,
                @"^([a-zA-Z]+:\/\/)?([^\/]+)\/.*?$",
                "$2"
            );
        }

        public static string GenerateGoodTitleQueryString(string input)
        {
            string result; 

            input = input.Replace("'", "");
            input = input.Replace(@"""", "");
            input = input.Replace(@".", "-");
            input = input.Replace(@" ", "-");
            input = input.Replace(@"&quot;", "");
            input = input.Replace(@";", "");
            input = input.Replace(@":", "-");
            input = input.Replace(@"&", "");
            if (input.Length > 200)
            {
                result = input.Substring(0, 200);

            }
            else
            {
                result = input;
            }
            return result;
        }
    }
}
